Skip to content

refactor: 统一多身份操作者网关契约 - #317

Merged
xlorne merged 1 commit into
devfrom
feature/issue-315-operator-key-gateway
Dec 4, 2026
Merged

xlorne merged 1 commit into
devfrom
feature/issue-315-operator-key-gateway

Conversation

@xlorne

@xlorne xlorne commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

背景

FlowOperatorGateway 的 get(long, String) / findByIds(List<Long>, String) 通过默认实现静默退化为默认身份查询,导致下游未实现多身份能力时编译和调用成功,但身份在运行期丢失。IRepositoryHolder 与脚本解析器也重复了同类契约。

改动

  • FlowOperatorGateway 改为抽象的 get(OperatorKey) / findByKeys(List<OperatorKey>);默认身份 get(long) / findByIds(List<Long>) 仅作为派生便捷方法。
  • IRepositoryHolder 同步改为 getOperatorByKey(OperatorKey) / findOperatorsByKeys(List<OperatorKey>),移除拆分身份参数的默认重载。
  • GatewayContext、FlowOperatorLocalThreadCache、流程树预载与脚本解析器统一按 OperatorKey 处理混合身份,保留请求顺序并避免 N+1。
  • 显式非默认身份不一致的结果不会进入线程缓存,也不会作为批量查询结果返回;保留运行期告警。默认身份读取保持历史兼容。
  • 更新示例网关、相关服务调用、测试及多身份接入文档。

兼容性

这是有意的源码不兼容调整。自行实现 FlowOperatorGateway 的下游需要迁移到 OperatorKey 契约;具体迁移见 docs/Integration/operator-identity.md 3.2。

验证

  • ./mvnw -o clean test:全项目 7 个模块构建成功,581 个用例全部通过(framework 549,其余模块 32)。
  • 新增 FlowOperatorKeyGatewayTest,覆盖混合身份一次批量回查、顺序保留、缓存隔离、默认身份派生入口及旧重载移除。

Closes #315

FlowOperatorGateway 与 IRepositoryHolder 改用 OperatorKey 查询,移除静默丢弃身份的默认重载;脚本解析器与流程树改为一次批量回查完整参与人列表,并同步缓存、示例和集成文档。

Closes #315
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.93548% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.57%. Comparing base (e04499f) to head (992adae).

Files with missing lines Patch % Lines
...gapi/flow/service/impl/FlowProcessNodeService.java 73.52% 4 Missing and 5 partials ⚠️
...ngapi/flow/cache/FlowOperatorLocalThreadCache.java 82.05% 2 Missing and 5 partials ⚠️
...dingapi/flow/script/operator/PendingOperators.java 75.00% 1 Missing and 3 partials ⚠️
...ava/com/codingapi/flow/context/GatewayContext.java 84.21% 1 Missing and 2 partials ⚠️
.../com/codingapi/flow/session/IRepositoryHolder.java 0.00% 2 Missing ⚠️
...odingapi/flow/context/RepositoryHolderContext.java 75.00% 1 Missing ⚠️
.../com/codingapi/flow/mock/MockRepositoryHolder.java 75.00% 1 Missing ⚠️
...odingapi/flow/service/impl/FlowReissueService.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #317      +/-   ##
============================================
+ Coverage     76.51%   76.57%   +0.05%     
  Complexity     2197     2197              
============================================
  Files           288      288              
  Lines          8867     8878      +11     
  Branches       1055     1057       +2     
============================================
+ Hits           6785     6798      +13     
+ Misses         1557     1551       -6     
- Partials        525      529       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xlorne
xlorne merged commit b05a4cb into dev Dec 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant